package com.xiaoyu.izf.model.exception;

import java.io.Serializable;

public class BusinessException extends RuntimeException implements Serializable {

    private int code;

    public BusinessException(int code,String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(BusinessStatusEnum statusEnum){
        super(statusEnum.message());
        this.code = statusEnum.status();
    }

    public BusinessException(BusinessStatusEnum statusEnum, String args){
        super(String.format(statusEnum.message(),args));
        this.code = statusEnum.status();
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
